<!-- 历史信号 -->
<!-- 项目详情页 -->
<template>
  <div class="py-4">
    <div class="mt-4 row">
      <div class="col-12">
        <div class="card">
          <div class="card-header">
            <h4 class="card-title">History</h4>
          </div>
          <div class="card-body">
            <el-table
              v-loading="loading"
              :data="tableData"
              header-row-class-name="thead-light text-secondary text-xxs font-weight-bolder opacity-7"
            >
              <el-table-column label="#" min-width="70" sortable>
                <template #default="scope">
                  <span class="">{{ scope.$index + 1 }}</span>
                </template>
              </el-table-column>
              <el-table-column prop="createtime" label="Signal Time" min-width="120" sortable />
              <el-table-column
                prop="price"
                label="Price on Signal"
                min-width="120"
                sortable
              >
                <template #default="{ row }">
                  <span class="">$ {{ row.price }}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="price"
                label="Signal Price"
                min-width="120"
                sortable
              >
                <template #default="{ row }">
                  <h6 v-if="row.price" class="text-sm mb-0">
                    $ {{ row.price }}
                  </h6>
                </template>
              </el-table-column>
              <el-table-column
                prop="signal"
                label="Action"
                min-width="100"
                sortable
              >
                <template #default="{ row }">
                  <span v-if="row.signal == 1">做多</span>
                  <span v-if="row.signal == 2">平多</span>
                  <span v-if="row.signal == 3">做空</span>
                  <span v-if="row.signal == 4">平空</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="tradetime"
                label="Signal Interval"
                min-width="130"
                sortable
              >
                <template #default="{ row }">
                  <span v-if="row.tradetime == 1">15F</span>
                  <span v-if="row.tradetime == 2">1H</span>
                  <span v-if="row.tradetime == 3">2H</span>
                  <span v-if="row.tradetime == 4">6H</span>
                  <span v-if="row.tradetime == 5">12H</span>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { signalHistory } from "@/request/api.js";
//   import SoftButton from "@/components/SoftButton.vue";

export default {
  data() {
    return {
      tableData: [],
      loading: false,
      timeType: 1,
    };
  },
  created() {
    this.getSignalHistory();
  },
  methods: {
    async getSignalHistory() {
      this.loading = true;
      let id = localStorage.getItem("project_id");
      let params = {
        page: 1,
        pageSize: 10,
        project_id: id,
        tradetime: this.timeType,
      };
      let res = await signalHistory(params);
      this.loading = false;
      this.tableData = res.data;
    },
  },
};
</script>

<style></style>
